﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using TanmiaGrp.GeneralLedger.Core;
using TanmiaGrp.GeneralLedger.Domain;

namespace TanmiaGrp.GeneralLedger.WinApp.Scenarios
{
    //TASK: TransactionalAccounts must be refreshed when the view is closed and re-opened.
    public class JournalEditorViewModel : BaseEditorViewModel<Journal, JournalDomain>
    {
        public AccountDomain AccountDomain
        {
            get { return new AccountDomain(); }
        }

        public ICollectionView TransactionalAccounts { get; protected set; }

        public JournalEditorViewModel()
        {
            BusinessDomain = JournalDomain.Obj;

            TransactionalAccounts = CollectionViewSource.GetDefaultView(AccountDomain.GetTransactionalAccounts());

            BrowserInitializedEvent = Events.JournalBrowserInitialized;
            EntityNavigationEvent = Events.JournalEntityNavigation;
            EntitySavedOrDeletedEvent = Events.JournalEntitySavedOrDeleted;
            PageNavigationEvent = Events.JournalPageNavigation;

            Initialize();
        }


    }
}
